<!DOCTYPE html><html><head><title>Ext.data.SortTypes | Ext JS 4.0 Documentation</title><script type="text/javascript" src="../ext-all.js"></script><link rel="stylesheet" href="../reset.css" type="text/css"><link rel="stylesheet" href="../scrollbars.css" type="text/css"><link rel="stylesheet" href="../docs.css" type="text/css"><link id="styleCss" rel="stylesheet" href="../style.css" type="text/css"><script type="text/javascript" src="../prettify.js"></script><link rel="stylesheet" href="../prettify.css" type="text/css"><!-- link(rel: 'stylesheet', href: req.baseURL + '/css/ext4.css', type: 'text/css')--><link rel="shortcut icon" type="image/ico" href="../favicon.ico"><!--[if IE]>
<style type="text/css">.head-band { display: none; }
.header { border: 0; top: 0; left: 0px; background: url(../header.gif) repeat-x; }
.doc-tab .members .member a.more { background-color: #efefef; }
</style><link rel="stylesheet" href="/new/css/ie.css" type="text/css"><![endif]-->
</head><body id="ext-body" class="iScroll"><div id="notice" class="notice">For up to date documentation and features, visit 
<a href="http://docs.sencha.com/ext-js/4-0">http://docs.sencha.com/ext-js/4-0</a></div><div class="wrapper"><div class="head-band"></div><div class="header"><h2><a href="../index.html">Sencha Documentation</a></h2></div><div id="search"><form><input type="text" placeholder="Search" id="search-field" autocomplete="off" name="q"></form><div id="search-box"></div></div><div id="treePanel"></div><div id="container"><script type="text/javascript">

    req = {
        liveURL: '.',
        standAloneMode: true,
        origDocClass: 'Ext.data.SortTypes',
        docClass: 'Ext.data.SortTypes',
        docReq: 'Ext.data.SortTypes',
        version: '4.0',
        baseURL: '.',
        baseDocURL: '.',
        baseProdURL: '.'
    };

    clsInfo = {};



</script>

<script type="text/javascript" src="../search.js"></script>
<!--script type="text/javascript" src="/new/javascripts/app/examples.js"></script-->
<script type="text/javascript" src="../class_tree.js"></script>
<script type="text/javascript" src="../class_doc.js"></script>
<script type="text/javascript">
    req.source = 'SortTypes.html#Ext-data.SortTypes';
    clsInfo = {"methods":["asDate","asFloat","asInt","asText","asUCString","asUCText","none"],"cfgs":[],"properties":["stripTagsRE"],"events":[],"subclasses":[]};
    Ext.onReady(function() {
        Ext.create('Docs.classPanel');
    });
</script><div id="top-block" class="top-block"><h1 id="clsTitle" class="cls"><a href="../source/SortTypes.html#Ext-data.SortTypes" target="_blank">Ext.data.SortTypes</a></h1></div><div id="docContent"><div id="doc-overview-content"><div class="lft"><p>This class defines a series of static methods that are used on a
<a href="Ext.data.Field.html" rel="Ext.data.Field" class="docClass">Ext.data.Field</a> for performing sorting. The methods cast the
underlying values into a data type that is appropriate for sorting on
that particular field.  If a <a href="Ext.data.Field.html#type" rel="Ext.data.Field#type" class="docClass">Ext.data.Field.type</a> is specified,
the sortType will be set to a sane default if the sortType is not
explicitly defined on the field. The sortType will make any necessary
modifications to the value and return it.</p>

<ul>
<li><b>asText</b> - Removes any tags and converts the value to a string</li>
<li><b>asUCText</b> - Removes any tags and converts the value to an uppercase string</li>
<li><b>asUCText</b> - Converts the value to an uppercase string</li>
<li><b>asDate</b> - Converts the value into Unix epoch time</li>
<li><b>asFloat</b> - Converts the value to a floating point number</li>
<li><b>asInt</b> - Converts the value to an integer number</li>
</ul>


<p>
It is also possible to create a custom sortType that can be used throughout
an application.
<pre class="prettyprint"><code>Ext.apply(Ext.data.SortTypes, {
    asPerson: function(person){
        // expects an object with a first and last name property
        return person.lastName.toUpperCase() + person.firstName.toLowerCase();
    }    
});

Ext.define('Employee', {
    extend: 'Ext.data.Model',
    fields: [{
        name: 'person',
        sortType: 'asPerson'
    }, {
        name: 'salary',
        type: 'float' // sortType set to asFloat
    }]
});
</code></pre>
</p>

<div class="members"><div class="m-properties"><a name="properties"></a><div class="definedBy">Defined By</div><h3 class="prp p">Properties</h3><div id="property-stripTagsRE" class="member f ni"><a href="Ext.data.SortTypes.html#property-stripTagsRE" rel="property-stripTagsRE" class="expand more"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-property-stripTagsRE" class="viewSource">view source</a></div><a name="stripTagsRE"></a><a name="property-stripTagsRE"></a><a href="Ext.data.SortTypes.html#" rel="property-stripTagsRE" class="cls expand">stripTagsRE</a><span> : RegExp</span></div><div class="description"><div class="short"><p>The regular expression used to strip tags</p>
</div><div class="long"><p>The regular expression used to strip tags</p>
</div></div></div></div><div class="m-methods"><a name="methods"></a><div class="definedBy">Defined By</div><h3 class="mth p">Methods</h3><div id="method-asDate" class="member f ni"><a href="Ext.data.SortTypes.html#method-asDate" rel="method-asDate" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asDate" class="viewSource">view source</a></div><a name="asDate"></a><a name="method-asDate"></a><a href="Ext.data.SortTypes.html#" rel="method-asDate" class="cls expand">asDate</a>(
<span class="pre">Mixed s</span>)
 : Number</div><div class="description"><div class="short"><p>Date sorting</p>
</div><div class="long"><p>Date sorting</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The comparison value</p>
</li></ul></div></div></div><div id="method-asFloat" class="member ni"><a href="Ext.data.SortTypes.html#method-asFloat" rel="method-asFloat" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asFloat" class="viewSource">view source</a></div><a name="asFloat"></a><a name="method-asFloat"></a><a href="Ext.data.SortTypes.html#" rel="method-asFloat" class="cls expand">asFloat</a>(
<span class="pre">Mixed s</span>)
 : Float</div><div class="description"><div class="short"><p>Float sorting</p>
</div><div class="long"><p>Float sorting</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Float</span>&nbsp; &nbsp;<p>The comparison value</p>
</li></ul></div></div></div><div id="method-asInt" class="member ni"><a href="Ext.data.SortTypes.html#method-asInt" rel="method-asInt" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asInt" class="viewSource">view source</a></div><a name="asInt"></a><a name="method-asInt"></a><a href="Ext.data.SortTypes.html#" rel="method-asInt" class="cls expand">asInt</a>(
<span class="pre">Mixed s</span>)
 : Number</div><div class="description"><div class="short"><p>Integer sorting</p>
</div><div class="long"><p>Integer sorting</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Number</span>&nbsp; &nbsp;<p>The comparison value</p>
</li></ul></div></div></div><div id="method-asText" class="member ni"><a href="Ext.data.SortTypes.html#method-asText" rel="method-asText" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asText" class="viewSource">view source</a></div><a name="asText"></a><a name="method-asText"></a><a href="Ext.data.SortTypes.html#" rel="method-asText" class="cls expand">asText</a>(
<span class="pre">Mixed s</span>)
 : String</div><div class="description"><div class="short"><p>Strips all HTML tags to sort on text only</p>
</div><div class="long"><p>Strips all HTML tags to sort on text only</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The comparison value</p>
</li></ul></div></div></div><div id="method-asUCString" class="member ni"><a href="Ext.data.SortTypes.html#method-asUCString" rel="method-asUCString" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asUCString" class="viewSource">view source</a></div><a name="asUCString"></a><a name="method-asUCString"></a><a href="Ext.data.SortTypes.html#" rel="method-asUCString" class="cls expand">asUCString</a>(
<span class="pre">Mixed s</span>)
 : String</div><div class="description"><div class="short"><p>Case insensitive string</p>
</div><div class="long"><p>Case insensitive string</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The comparison value</p>
</li></ul></div></div></div><div id="method-asUCText" class="member ni"><a href="Ext.data.SortTypes.html#method-asUCText" rel="method-asUCText" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-asUCText" class="viewSource">view source</a></div><a name="asUCText"></a><a name="method-asUCText"></a><a href="Ext.data.SortTypes.html#" rel="method-asUCText" class="cls expand">asUCText</a>(
<span class="pre">Mixed s</span>)
 : String</div><div class="description"><div class="short"><p>Strips all HTML tags to sort on text only - Case insensitive</p>
</div><div class="long"><p>Strips all HTML tags to sort on text only - Case insensitive</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">String</span>&nbsp; &nbsp;<p>The comparison value</p>
</li></ul></div></div></div><div id="method-none" class="member ni"><a href="Ext.data.SortTypes.html#method-none" rel="method-none" class="expand more ar"><span>&nbsp;</span></a><div class="title"><div class="meta"><a href="Ext.data.SortTypes.html" class="definedIn docClass">Ext.data.SortTypes</a><br/><a href="../source/SortTypes.html#Ext-data.SortTypes-method-none" class="viewSource">view source</a></div><a name="none"></a><a name="method-none"></a><a href="Ext.data.SortTypes.html#" rel="method-none" class="cls expand">none</a>(
<span class="pre">Mixed s</span>)
 : Mixed</div><div class="description"><div class="short"><p>Default sort that does nothing</p>
</div><div class="long"><p>Default sort that does nothing</p>
<h3 class="pa">Parameters</h3><ul><li><span class="pre">s</span> : Mixed<div class="sub-desc"><p>The value being converted</p>
</div></li></ul><h3 class="pa">Returns</h3><ul><li><span class="pre">Mixed</span>&nbsp; &nbsp;<p>The comparison value</p>
</li></ul></div></div></div></div></div></div></div><div id="pageContent"></div></div></div></div></body></html>